﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ShopCart.ascx.cs" Inherits="Thuoc24h.Home.Controls.ShopCart" %>
<%@ Register TagPrefix="cc" Namespace="MSCaptcha" Assembly="MSCaptcha" %>

<style type="text/css">
    .item p { padding: 4px 0; }
    .mGrid { width: 100%; }
    .mGrid img.imgCart { width: 100px; }
    .mGrid tr th { border-bottom: 1px solid #ddd; color: green; font-size: 13px; padding: 5px; }
    .mGrid tr td { border-bottom: 1px solid #ddd; color: #222; font-size: 13px; padding: 5px; }
    .QuantityTxt { border: solid 1px #ddd; height: 20px; line-height: 20px; padding: 2px; }
    .DeleteButton { color: red; text-decoration: none; }
    .DeleteButton:hover { text-decoration: underline; }
</style>
<script>
    $(function () {
        $('#btnthanhtoan').click(function () {
            $('#custom-type').css('display', 'block');

        });

        $('#<%=rdoCu.ClientID%>').click(function () {
            $find('modelpopup').show();
        });


    });
</script>

<h1 class="TopHeader">Giỏ hàng</h1>
<div class="maincontent">
    <asp:PlaceHolder runat="server" ID="HasProductPLH">
        <asp:ListView runat="server" ID="OrderProduct" OnItemDataBound="OrderProduct_ItemDataBound"
            OnItemDeleting="OrderProduct_ItemDeleting" DataKeyNames="ID">
            <LayoutTemplate>
                <table class="mGrid" cellpadding="0" cellspacing="0">
                    <tr>
                        <th>STT
                        </th>
                        <th>Hình ảnh
                        </th>
                        <th>Tên sản phẩm
                        </th>
                        <th>Số lượng
                        </th>
                        <th>Đơn giá
                        </th>
                        <th>Xóa
                        </th>
                    </tr>
                    <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%# Container.DataItemIndex + 1 %>
                        <asp:Label runat="server" ID="lblProductID" Visible="false" Text='<%# Eval("ID") %>'></asp:Label>
                    </td>
                    <td>
                        <img src='<%# Eval("ThumbImage") %>' class="imgCart" />
                    </td>
                    <td>
                        <%# Eval("Name") %>
                    </td>
                    <td>
                        <asp:TextBox runat="server" ID="txtQuantity" Width="100px" Text='<%# Eval("Quantity") %>'
                            MaxLength="3" CssClass="QuantityTxt"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="lblPrice" Text='<%#Double.Parse(Eval("Price").ToString()).ToString("#,###") %>'> </asp:Label>
                        đ
                    </td>
                    <td>
                        <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Delete" CssClass="DeleteButton" CausesValidation="false"
                            CommandArgument='<%# Eval("ID") %>' OnClientClick="return confirm('Bạn có chắc chắn xóa không?')">Xóa</asp:LinkButton>
                    </td>
                </tr>
            </ItemTemplate>
        </asp:ListView>
        <div class="W98" style="text-align: right; margin-right: 20px">
            <span style="font-size: 10pt; font-weight: bold">Tổng tiền:</span>
            <asp:Label runat="server" ID="lblTotalPrice" ForeColor="Red" Font-Bold="true" Font-Italic="true"
                Font-Size="12pt"> </asp:Label>
            <span style="color: red">đ </span>
        </div>



        <div class="ShopCartButtonWrapper" style="margin-top: 15px; display: inline-block; width: 100%;">
            <table>
                <tr>
                    <td>
                        <asp:Button ID="btnBuyNext" runat="server" OnClick="btnBuyNext_Click" Text="Tiếp tục mua hàng" CausesValidation="False"
                            CssClass="Button" />
                    </td>
                    <td>
                        <asp:Button runat="server" ID="btnUpdateCart" Text="Cập nhật giỏ hàng" OnClick="btnUpdateCart_Click" CausesValidation="False"
                            CssClass="Button" />
                    </td>
                    <td>

                        <input type="button" class="Button" value="Thanh toán" id="btnthanhtoan"></input>

                    </td>
                </tr>
            </table>
        </div>

        <div id="custom-type" style="padding: 10px 0 0 10px; display: none;">
            <asp:RadioButton runat="server" ID="rdoCu" Text="Khách hàng cũ" GroupName="Customtype" /><br />
            <br />
            <asp:RadioButton runat="server" ID="rdoNew" Text="Khách hàng mới" GroupName="Customtype" />

        </div>


        <div class="contact">
            <p style="padding: 8px 30px;">
                <div class="notice">
                    Quý khách thanh toán. Xin vui lòng điền đầy đủ thông tin theo mẫu dưới đây.
                </div>
            </p>
            <div class="item"><b>Thông tin người mua</b></div>
            <div class="item">
                <label>
                    Họ tên<i>*</i></label><asp:TextBox runat="server" ID="txtName"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Dynamic"
                    ErrorMessage="(*)" ForeColor="red" ControlToValidate="txtName"></asp:RequiredFieldValidator>
            </div>
            <div class="item">
                <label>
                    Điện thoại</label><asp:TextBox runat="server" ID="txtPhone" MaxLength="20"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Display="Dynamic"
                    ErrorMessage="(*)" ForeColor="red" ControlToValidate="txtPhone"></asp:RequiredFieldValidator>
            </div>
            <div class="item">
                <label>
                    Email<i>*</i></label><asp:TextBox runat="server" ID="txtEmail"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
                    ErrorMessage="(*)" ForeColor="red" ControlToValidate="txtEmail"></asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Nhập lại e-mail"
                    ForeColor="red" ControlToValidate="txtEmail" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
            </div>
            <div class="item">
                <label>
                    Địa chỉ<i>*</i></label><asp:TextBox runat="server" ID="txtAddress"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Display="Dynamic"
                    ErrorMessage="(*)" ForeColor="red" ControlToValidate="txtAddress"></asp:RequiredFieldValidator>
            </div>


            <div class="item"><b>Thông tin người nhận</b></div>
            <div class="item">
                <label>
                    Họ tên</label><asp:TextBox runat="server" ID="txtReceiverName"></asp:TextBox>

            </div>
            <div class="item">
                <label>
                    Điện thoại</label><asp:TextBox runat="server" ID="txtReceiverPhone" MaxLength="20"></asp:TextBox>

            </div>
            <div class="item">
                <label>
                    Email</label><asp:TextBox runat="server" ID="txtReceiverEmail"></asp:TextBox>

                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Nhập lại e-mail"
                    ForeColor="red" ControlToValidate="txtEmail" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
            </div>
            <div class="item">
                <label>
                    Địa chỉ</label><asp:TextBox runat="server" ID="txtReceiverAddress"></asp:TextBox>

            </div>
            <div class="item">
                <label>
                    Thời gian muốn giao hàng</label>
                <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
                </asp:ToolkitScriptManager>

                <asp:TextBox ID="txtReceiverDate" runat="server" Width="100px"></asp:TextBox>

                <asp:CalendarExtender
                    ID="CalendarExtender1"
                    TargetControlID="txtReceiverDate"
                    runat="server" />

            </div>
            <div style="padding-left: 200px;" id="phuongthucgiahang">
                <asp:RadioButton runat="server" ID="rdogiaohang" Text="Hỏa tốc trong ngày/ 3 – 5 ngày" GroupName="type" /><br />
                <asp:RadioButton runat="server" ID="rdoThoigian" Text="Giờ hành chính/ngoài giờ" GroupName="type" />

            </div>
            <div class="item">
                <label>
                    Lưu ý cho Medlife khi giao hàng</label><asp:TextBox runat="server" ID="txtDetail" TextMode="MultiLine"></asp:TextBox>

            </div>
            <div class="item">
                <label>
                    Phương thức thanh toán</label>

                <asp:DropDownList ID="ddlPayMethod" runat="server" OnSelectedIndexChanged="ddlPayMethod_OnSelectedIndexChanged" AutoPostBack="True">
                    <asp:ListItem Value="">-- Kiểu thanh toán --</asp:ListItem>
                    <asp:ListItem Value="1">Thanh toán an toàn qua bảo kim</asp:ListItem>
                    <asp:ListItem Value="2">Chuyển khoản</asp:ListItem>
                    <asp:ListItem Value="3">Thanh toán khi nhận hàng</asp:ListItem>
                </asp:DropDownList>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" Display="Dynamic"
                    ErrorMessage="(*)" ForeColor="red" ControlToValidate="ddlPayMethod"></asp:RequiredFieldValidator>
            </div>
                    <div class="item">
            <label class="fleft">
                Nhập mã xác nhận<i>*</i></label>
            <cc:CaptchaControl ID="CaptchaControl1" runat="server" CssClass="ms-captcha fleft"
                CaptchaBackgroundNoise="Medium" CaptchaLineNoise="Low" />
            <asp:TextBox ID="txtCaptcha" Width="80" runat="server" MaxLength="5" AutoPostBack="False"
                CssClass="txt-captcha fleft" />  <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" Display="Dynamic"
                    ErrorMessage="(*)" ForeColor="red" ControlToValidate="txtCaptcha"></asp:RequiredFieldValidator>
            <br class="clear" />
        </div>
        </div>
        <asp:Panel runat="server" ID="pnlBaokim">

            <div class="ShopCartButtonWrapper" style="margin-top: 15px; display: inline-block; width: 100%;">
                <table style="width: 100%;">
                    <tr>
                        <td>&nbsp;</td>
                        <td style="text-align: center">
                            <asp:ImageButton ID="btnPayBaoKim" runat="server" OnClick="btnPayBaoKim_OnClick" />
                        </td>
                        <td style="text-align: left;">
                            <%-- <asp:ImageButton runat="server" ID="btnPayNganluong" OnClick="btnPayNganluong_OnClick" />--%>
                        </td>

                    </tr>
                </table>
            </div>
        </asp:Panel>

        <asp:Panel runat="server" ID="pnlInfo">
            <div class="item" style="color: #17720C; background: #f7f7f7; padding: 4px 100px; margin: 10px 0">
                <p>Thông tin tài khoản</p>
                <p>
                    <label>Tên chủ khoản:Nguyễn Thị Minh Ánh</label></p>
                <p>
                    <label>Mã số tài khoản:123 323 1223</label></p>
                <p>
                    <label>Chi nhánh: Ngân hàng công thương abc.</label></p>

            </div>

        </asp:Panel>

        <asp:Panel runat="server" ID="pnlThanhtoan">
            <div class="ShopCartButtonWrapper" style="margin-top: 15px; display: inline-block; width: 100%;">
                <table style="width: 100%;">
                    <tr>

                        <td style="text-align: center">
                            <asp:Button ID="btThanhtoan" runat="server" CssClass="Button" Text="Thanh toán" OnClick="btnThanhtoan_OnClick" />
                        </td>


                    </tr>
                </table>
            </div>
        </asp:Panel>

    </asp:PlaceHolder>
    <asp:PlaceHolder runat="server" ID="NoProductPLH">
        <div class="notice">
            Chưa có sản phẩm nào trong giỏ hàng của bạn!
        </div>
    </asp:PlaceHolder>
</div>





<asp:Button ID="btnTemp" runat="server" Style="display: none" />
<asp:ModalPopupExtender ID="mpePopup" runat="server" PopupControlID="Panel1" TargetControlID="btnTemp" BehaviorID="modelpopup"
    CancelControlID="btnClose" BackgroundCssClass="modalBackground">
</asp:ModalPopupExtender>

<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" Style="display: none">
    <div style="width: 360px; background: #fff; position: relative; border-radius: 4px; padding: 30px">
        <span style="position: absolute; right: -1px; top: -1px; z-index: 100;">
            <asp:ImageButton CssClass="nopad" runat="server" ImageUrl="/Themes/Images/cancel.png" ID="btnClose"></asp:ImageButton></span>
        <table id="LoginTable">
            <tr>
                <td>Tên đăng nhập
                </td>
                <td>
                    <asp:TextBox runat="server" ID="UserNameTxt"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="UserNameTxt" ErrorMessage="(*)" ValidationGroup="g1"
                        ForeColor="red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>Mật khẩu
                </td>
                <td>
                    <asp:TextBox runat="server" ID="PasswordTxt" TextMode="Password"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="PasswordTxt" ErrorMessage="(*)" ValidationGroup="g1"
                        ForeColor="red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: center;">
                    <asp:Button runat="server" ID="LoginBtn" CssClass="Button" Text="Đăng nhập" ValidationGroup="g1" OnClick="LoginBtn_OnClick" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Label runat="server" ForeColor="red" ID="MessageLtr"></asp:Label></td>
            </tr>
        </table>
    </div>
</asp:Panel>

